package com.ymatou.promotion.api.service;

import org.json.JSONObject;

import com.ymt.base.YmatouBaseCall;
import com.ymttest.utils.EnvSetup;

/**
 * 获取优惠券批次信息接口Call FreeMaker Template自动生成代码
 */
public class GetCouponBatchCall extends YmatouBaseCall {
	private static String opurl = "api/Coupon/GetCouponBatch";

	public GetCouponBatchCall() {
		super(EnvSetup.getSystemUrl("promition_api_coupon"), opurl, "POST",
				"JSON");
	}

	@Override
	public void addDefHeader() {
		client.addHeader("Accept",
				"text/xml,text/javascript,text/html,application/json");
		client.addHeader("Content-Type", "application/json; charset=UTF-8");
	}

	/**
	 * 获取Code
	 * 
	 * @return
	 */
	public String getCode() {
		String Code = null;
		try {
			Code = new JSONObject(getReturnData()).getString("Code");
		} catch (Exception e) {
			e.printStackTrace();
		}
		return Code;
	}

	/**
	 * 获取BCode
	 * 
	 * @return
	 */
	public String getBCode() {
		String Code = null;
		try {
			Code = new JSONObject(getReturnData()).getString("BCode");
		} catch (Exception e) {
			e.printStackTrace();
		}
		return Code;
	}

	/**
	 * 获取Msg
	 * 
	 * @return
	 */
	public String getMsg() {
		String Code = null;
		try {
			Code = new JSONObject(getReturnData()).getString("Msg");
		} catch (Exception e) {
			e.printStackTrace();
		}
		return Code;
	}

	/**
	 * 获取MessageText
	 * 
	 * @return
	 */
	public String getMessageText() {
		String Code = null;
		try {
			Code = new JSONObject(
					new JSONObject(getReturnData()).getString("Data"))
					.getString("MessageText");
		} catch (Exception e) {
			e.printStackTrace();
		}
		return Code;
	}

	/**
	 * 获取Totals
	 * 
	 * @return
	 */
	public String getTotals() {
		String Code = null;
		try {
			Code = new JSONObject(
					new JSONObject(getReturnData()).getString("Data"))
					.getString("Totals");
		} catch (Exception e) {
			e.printStackTrace();
		}
		return Code;
	}

	/**
	 * 获取BatchCode
	 * 
	 * @return
	 */
	public String getBatchCode() {
		String Code = null;
		try {
			Code = new JSONObject(
					new JSONObject(new JSONObject(getReturnData().replace("[", "").replace("]", ""))
							.getString("Data")).getString("CouponBatchs"))
					.getString("BatchCode");
		} catch (Exception e) {
			e.printStackTrace();
		}
		return Code;
	}

	/**
	 * 获取BatchPrefix
	 * 
	 * @return
	 */
	public String getBatchPrefix() {
		String Code = null;
		try {
			Code = new JSONObject(
					new JSONObject(new JSONObject(getReturnData().replace("[", "").replace("]", ""))
							.getString("Data")).getString("CouponBatchs"))
					.getString("BatchPrefix");
		} catch (Exception e) {
			e.printStackTrace();
		}
		return Code;
	}
	

	/**
	 * 获取SellerId
	 * 
	 * @return
	 */
	public String getSellerId() {
		String Code = null;
		try {
			Code = new JSONObject(
					new JSONObject(new JSONObject(getReturnData().replace("[", "").replace("]", ""))
							.getString("Data")).getString("CouponBatchs"))
					.getString("SellerId");
		} catch (Exception e) {
			e.printStackTrace();
		}
		return Code;
	}
	

	/**
	 * 获取CouponName
	 * 
	 * @return
	 */
	public String getCouponName() {
		String Code = null;
		try {
			Code = new JSONObject(
					new JSONObject(new JSONObject(getReturnData().replace("[", "").replace("]", ""))
							.getString("Data")).getString("CouponBatchs"))
					.getString("CouponName");
		} catch (Exception e) {
			e.printStackTrace();
		}
		return Code;
	}
	
	/**
	 * 获取CouponDesc
	 * 
	 * @return
	 */
	public String getCouponDesc() {
		String Code = null;
		try {
			Code = new JSONObject(
					new JSONObject(new JSONObject(getReturnData().replace("[", "").replace("]", ""))
							.getString("Data")).getString("CouponBatchs"))
					.getString("CouponDesc");
		} catch (Exception e) {
			e.printStackTrace();
		}
		return Code;
	}

	/**
	 * 获取CouponValue
	 * 
	 * @return
	 */
	public String getCouponValue() {
		String Code = null;
		try {
			Code =new JSONObject( new JSONObject(
					new JSONObject(new JSONObject(getReturnData().replace("[", "").replace("]", ""))
							.getString("Data")).getString("CouponBatchs"))
					.getString("CouponValues")).getString("CouponValue");
		} catch (Exception e) {
			e.printStackTrace();
		}
		return Code;
	}
	
	/**
	 * 获取OrderValue
	 * 
	 * @return
	 */
	public String getOrderValue() {
		String Code = null;
		try {
			Code =new JSONObject( new JSONObject(
					new JSONObject(new JSONObject(getReturnData().replace("[", "").replace("]", ""))
							.getString("Data")).getString("CouponBatchs"))
					.getString("CouponValues")).getString("OrderValue");
		} catch (Exception e) {
			e.printStackTrace();
		}
		return Code;
	}
	

	/**
	 * 获取MaxSendNum
	 * 
	 * @return
	 */
	public String getMaxSendNum() {
		String Code = null;
		try {
			Code = new JSONObject(
					new JSONObject(new JSONObject(getReturnData().replace("[", "").replace("]", ""))
							.getString("Data")).getString("CouponBatchs"))
					.getString("MaxSendNum");
		} catch (Exception e) {
			e.printStackTrace();
		}
		return Code;
	}
	

	/**
	 * 获取UserMaxReceiveNum
	 * 
	 * @return
	 */
	public String getUserMaxReceiveNum() {
		String Code = null;
		try {
			Code = new JSONObject(
					new JSONObject(new JSONObject(getReturnData().replace("[", "").replace("]", ""))
							.getString("Data")).getString("CouponBatchs"))
					.getString("UserMaxReceiveNum");
		} catch (Exception e) {
			e.printStackTrace();
		}
		return Code;
	}
	

	/**
	 * 获取CreateTime
	 * 
	 * @return
	 */
	public String getCreateTime() {
		String Code = null;
		try {
			Code = new JSONObject(
					new JSONObject(new JSONObject(getReturnData().replace("[", "").replace("]", ""))
							.getString("Data")).getString("CouponBatchs"))
					.getString("CreateTime");
		} catch (Exception e) {
			e.printStackTrace();
		}
		return Code;
	}
	

	/**
	 * 获取ValidStart
	 * 
	 * @return
	 */
	public String getValidStart() {
		String Code = null;
		try {
			Code = new JSONObject(
					new JSONObject(new JSONObject(getReturnData().replace("[", "").replace("]", ""))
							.getString("Data")).getString("CouponBatchs"))
					.getString("ValidStart");
		} catch (Exception e) {
			e.printStackTrace();
		}
		return Code;
	}
	

	/**
	 * 获取ValidEnd
	 * 
	 * @return
	 */
	public String getValidEnd() {
		String Code = null;
		try {
			Code = new JSONObject(
					new JSONObject(new JSONObject(getReturnData().replace("[", "").replace("]", ""))
							.getString("Data")).getString("CouponBatchs"))
					.getString("ValidEnd");
		} catch (Exception e) {
			e.printStackTrace();
		}
		return Code;
	}
	

	/**
	 * 获取CreateStart
	 * 
	 * @return
	 */
	public String getCreateStart() {
		String Code = null;
		try {
			Code = new JSONObject(
					new JSONObject(new JSONObject(getReturnData().replace("[", "").replace("]", ""))
							.getString("Data")).getString("CouponBatchs"))
					.getString("CreateStart");
		} catch (Exception e) {
			e.printStackTrace();
		}
		return Code;
	}
	

	/**
	 * 获取CreateEnd
	 * 
	 * @return
	 */
	public String getCreateEnd() {
		String Code = null;
		try {
			Code = new JSONObject(
					new JSONObject(new JSONObject(getReturnData().replace("[", "").replace("]", ""))
							.getString("Data")).getString("CouponBatchs"))
					.getString("CreateEnd");
		} catch (Exception e) {
			e.printStackTrace();
		}
		return Code;
	}
	

	/**
	 * 获取HaveSendNum
	 * 
	 * @return
	 */
	public String getHaveSendNum() {
		String Code = null;
		try {
			Code = new JSONObject(
					new JSONObject(new JSONObject(getReturnData().replace("[", "").replace("]", ""))
							.getString("Data")).getString("CouponBatchs"))
					.getString("HaveSendNum");
		} catch (Exception e) {
			e.printStackTrace();
		}
		return Code;
	}
	
	/**
	 * 获取HaveUsedNum
	 * 
	 * @return
	 */
	public String getHaveUsedNum() {
		String Code = null;
		try {
			Code = new JSONObject(
					new JSONObject(new JSONObject(getReturnData().replace("[", "").replace("]", ""))
							.getString("Data")).getString("CouponBatchs"))
					.getString("HaveUsedNum");
		} catch (Exception e) {
			e.printStackTrace();
		}
		return Code;
	}
	
	/**
	 * 获取InvalidTime
	 * 
	 * @return
	 */
	public String getInvalidTime() {
		String Code = null;
		try {
			Code = new JSONObject(
					new JSONObject(new JSONObject(getReturnData().replace("[", "").replace("]", ""))
							.getString("Data")).getString("CouponBatchs"))
					.getString("InvalidTime");
		} catch (Exception e) {
			e.printStackTrace();
		}
		return Code;
	}
	
	/**
	 * 获取InvalidStatus
	 * 
	 * @return
	 */
	public String getInvalidStatus() {
		String Code = null;
		try {
			Code = new JSONObject(
					new JSONObject(new JSONObject(getReturnData().replace("[", "").replace("]", ""))
							.getString("Data")).getString("CouponBatchs"))
					.getString("InvalidStatus");
		} catch (Exception e) {
			e.printStackTrace();
		}
		return Code;
	}
	
	/**
	 * 获取UsePlatforms
	 * 
	 * @return
	 */
	public String getUsePlatforms() {
		String Code = null;
		try {
			Code = new JSONObject(
					new JSONObject(new JSONObject(getReturnData().replace("[", "").replace("]", ""))
							.getString("Data")).getString("CouponBatchs"))
					.getString("UsePlatforms");
		} catch (Exception e) {
			e.printStackTrace();
		}
		return Code;
	}
	
	/**
	 * 获取ScenarioType
	 * 
	 * @return
	 */
	public String getScenarioType() {
		String Code = null;
		try {
			Code = new JSONObject(
					new JSONObject(new JSONObject(getReturnData().replace("[", "").replace("]", ""))
							.getString("Data")).getString("CouponBatchs"))
					.getString("ScenarioType");
		} catch (Exception e) {
			e.printStackTrace();
		}
		return Code;
	}
	
	/**
	 * 获取ProductCodes
	 * 
	 * @return
	 */
	public String getProductCodes() {
		String Code = null;
		try {
			Code = new JSONObject(
					new JSONObject(new JSONObject(getReturnData().replace("[", "").replace("]", ""))
							.getString("Data")).getString("CouponBatchs"))
					.getString("ProductCodes");
		} catch (Exception e) {
			e.printStackTrace();
		}
		return Code;
	}
}